﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.DBM;

namespace KPIS.GERP.GHRMS.BLL
{
    public class AppraisalsBLL
    {
        IDBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
        public DataTable GetAppraisalsAround(int Year)
        {
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);

                dbManager.AddParameters(0, "@apr_year", Year);

                string strSQL = "select * from hrm_apr_appraisals where apr_year=@apr_year";

                //string strSQL = " SELECT " +
                //                " hrm_apr_appraisals.apr_period, " +
                //                " concat(hrm_apr_appraisals.apr_name,'  ', " +
                //                " cast(hrm_apr_appraisals.act_start_date as char),' ถึง ', " +
                //                " cast(hrm_apr_appraisals.act_end_date as char)) as apr_name " +
                //                " FROM " +
                //                " hrm_apr_appraisals " +
                //                " WHERE " +
                //                " hrm_apr_appraisals.apr_year =  @apr_year " +
                //                " Order By apr_period";
                DataSet ds = dbManager.ExecuteDataSet(CommandType.Text, strSQL);
                return ds.Tables[0];
            }
            catch
            {
                return null;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
    }
}
